import request from '@/utils/request';

//创建订单
export const orderCreate = (params: any) => {
    return request({
        url: '/app-api/order/create',
        method: 'POST',
        body: params,
        hideLoading: false,
    });
};
//提交支付订单
export const payOrderGet = (params: any) => {
    return request({
        url: '/app-api/pay/order/get',
        method: 'GET',
        body: params,
        hideLoading: false,
    });
};
//获得支付订单
export const orderSubmit = (params: any) => {
    return request({
        url: '/app-api/pay/order/submit',
        method: 'POST',
        body: params,
        hideLoading: false,
    });
};

//获得订单分页
export const orderPage = (params: any) => {
    return request({
        url: '/app-api/order/page',
        method: 'GET',
        body: params,
        hideLoading: false,
    });
};
//获得订单结算信息
export const ordersettlement = (params: any) => {
    return request({
        url: '/app-api/order/settlement',
        method: 'POST',
        body: params,
        hideLoading: false,
    });
};
//获得订单详情
export const orderGetDetail = (params: any) => {
    return request({
        url: '/app-api/order/get-detail',
        method: 'GET',
        body: params,
        hideLoading: false,
    });
};
//更新订单为已支付
export const orderUpdatePaid = (params: any) => {
    return request({
        url: '/app-api/order/update-paid',
        method: 'POST',
        body: params,
        hideLoading: false,
    });
};
//取消订单
export const orderCancel = (params: any) => {
    return request({
        url: `/app-api/order/cancel?id=${params}`,
        method: 'DELETE',
        hideLoading: false,
    });
};
//确认订单收货
export const orderReceive = (params: any) => {
    return request({
        url: `/app-api/order/receive`,
        method: 'PUT',
        body: params,
        hideLoading: false,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
    });
};
//申请售后
export const afterSaleBatchCreate = (params: any) => {
    return request({
        url: '/app-api/order/after-sale/batch/create',
        method: 'POST',
        body: params,
        hideLoading: false,
    });
};